#!/bin/bash

WORK_HOME=/root/workspace/flight-ultimate-client-portal

cd $WORK_HOME

git reset --hard
git pull origin dev
docker login --username=15527462726 registry.cn-shanghai.aliyuncs.com -p CNAlbert2021240158

rm -rf ./node_modules
rm -rf ./dist

yarn install && yarn run build

cp -r ./dist ./auto_deploy/scripts/ && rm -rf ./node_modules && rm -rf ./dist

chmod +x ./auto_deploy/scripts/start.sh
chmod +x ./auto_deploy/scripts/build.sh
chmod +x ./auto_deploy/scripts/push.sh
chmod +x ./auto_deploy/scripts/k8s/start.sh
chmod +x ./auto_deploy/scripts/k8s/variable_injection.sh

cd ./auto_deploy

source version
v=$V_PORTAL

echo "当前工作目录 `pwd`"
echo "版本号 ${V_SERVER}"

cd ./scripts

./start.sh
